Move test to a more appropriate location
authorCarol (Nichols || Goulding) <carol.nichols@gmail.com>
Sat, 19 Sep 2015 14:41:06 +0000 (10:41 -0400)
committerCarol (Nichols || Goulding) <carol.nichols@gmail.com>
Sun, 20 Sep 2015 03:30:37 +0000 (23:30 -0400)
This test isn't testing generate-lockfile at all-- it's generating a
lockfile with `\r\n` in it in the test itself and then testing that
building will succeed even if there are `\r\n`s in the lockfile.

Given that generate-lockfile could change and have no effect on this
test, I think this fits in better with the other `cargo build` tests.

tests/test_cargo_compile.rs
tests/test_cargo_generate_lockfile.rs

index 6b54f05c909e47a08011e9bb989e495d9d329a82..e16456977f9064c918f0492708e393dd9af9551e 100644 (file)
@@ -650,6 +650,31 @@ consider running `cargo update` to update a path dependency's locked version
 "));
 });
 
+test!(ignores_carriage_return_in_lockfile {
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [package]
+            name = "foo"
+            authors = []
+            version = "0.0.1"
+        "#)
+        .file("src/main.rs", r#"
+            mod a; fn main() {}
+        "#)
+        .file("src/a.rs", "");
+
+    assert_that(p.cargo_process("build"),
+                execs().with_status(0));
+
+    let lockfile = p.root().join("Cargo.lock");
+    let mut lock = String::new();
+    File::open(&lockfile).unwrap().read_to_string(&mut lock).unwrap();
+    let lock = lock.replace("\n", "\r\n");
+    File::create(&lockfile).unwrap().write_all(lock.as_bytes()).unwrap();
+    assert_that(p.cargo("build"),
+                execs().with_status(0));
+});
+
 test!(crate_version_env_vars {
     let p = project("foo")
         .file("Cargo.toml", r#"
index ddfa48ea73f0bd8d2a528831f69100e012057448..276791aa0338702216b385398cece1fbd4e2821f 100644 (file)
@@ -6,31 +6,6 @@ use hamcrest::assert_that;
 
 fn setup() {}
 
-test!(ignores_carriage_return {
-    let p = project("foo")
-        .file("Cargo.toml", r#"
-            [package]
-            name = "foo"
-            authors = []
-            version = "0.0.1"
-        "#)
-        .file("src/main.rs", r#"
-            mod a; fn main() {}
-        "#)
-        .file("src/a.rs", "");
-
-    assert_that(p.cargo_process("build"),
-                execs().with_status(0));
-
-    let lockfile = p.root().join("Cargo.lock");
-    let mut lock = String::new();
-    File::open(&lockfile).unwrap().read_to_string(&mut lock).unwrap();
-    let lock = lock.replace("\n", "\r\n");
-    File::create(&lockfile).unwrap().write_all(lock.as_bytes()).unwrap();
-    assert_that(p.cargo("build"),
-                execs().with_status(0));
-});
-
 test!(adding_and_removing_packages {
     let p = project("foo")
         .file("Cargo.toml", r#"